import 'package:flutter_magic_planet/common/http/api_comic_pingcc.dart';
import 'package:flutter_magic_planet/model/comic.dart';
import 'package:flutter_magic_planet/model/comic_chapter.dart';
import 'package:get/get.dart';

class ComicChapterListLogic extends GetxController {
  Comic comic = Comic();
  final chapters = <ComicChapter>[].obs;

  @override
  void onInit() {
    comic = Get.arguments;
    fetchChapters(comic.cartoonId ?? '');
    super.onInit();
  }

  fetchChapters(String id) async {
    chapters.value = await APIComicPingcc.getComicChapters(id: id);
  }
}
